package eventree;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;

public class Solution {
	private static class Forest {
		int root, size;
		public Forest(int root) {
			this.root = root;
			this.size = 1;
		}
	}
	private static void add(Map<Integer, List<Integer>> edges, int n1, int n2) {
		List<Integer> l = edges.get(n1);
		if(l == null) {
			l = new ArrayList<Integer>();
			edges.put(n1, l);
		}
		l.add(n2);
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		try {
			int N = in.nextInt(), M = in.nextInt();
			
			// map from node to the nodes to which edges exist
			Map<Integer, List<Integer>> edges = new HashMap<Integer, List<Integer>>();
			for(int i = 0; i < M; i++) {
				int n1 = in.nextInt();
				int n2 = in.nextInt();
				add(edges, n1, n2);
				add(edges, n2, n1);
			}

			Queue<Forest> forests = new LinkedList<Forest>();
			// forest corresponding to the each node
			Forest nodeForests[] = new Forest[N];
			// initially every node is in its own forest
			for(int node = 1; node <= N; node++) {
				Forest forest = new Forest(node);
				forests.add(forest);
				nodeForests[node - 1] = forest;
			}
			
			int result = M;
			while(!forests.isEmpty()) {
				Forest forest = forests.remove();
				List<Integer> connNodes = edges.get(forest.root);
				if(connNodes == null || connNodes.size() <= 0 || connNodes.size() > 1)
					continue;
				int connNode = connNodes.get(0);
				// merge the forest into the connected forest
				Forest connForest = nodeForests[connNode - 1];
				if(!forests.contains(connForest))
					forests.add(connForest);
				edges.remove(forest.root);
				edges.get(connNode).remove((Integer)forest.root);
				if(forest.size % 2 == 1) {
					// merging forest into connForest
					connForest.size += forest.size;
					result--;
				}
			}
			System.out.println(result);
		} finally {
			in.close();
		}
	}
}
